using System;
using Microsoft.Web.Management.Server;

namespace LeastPrivilege.CustomBasicAuthentication.Management
{
    // a module provider is the main entry point into a custom IIS GUI module
    // here the connection is made to 
    // a) the client UI module
    // b) the module service
    public class CustomBasicAuthenticationModuleProvider : ConfigurationModuleProvider
    {
        protected override string ConfigurationSectionName
        {
            get { return CustomBasicAuthenticationSection.SectionName; }
        }

        public override ModuleDefinition GetModuleDefinition(IManagementContext context)
        {
            string clientModuleName =
                "LeastPrivilege.CustomBasicAuthentication.Management.CustomBasicAuthenticationModule, LeastPrivilege.CustomBasicAuthentication.Management.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f20dc168dfd54966";
            
            return new ModuleDefinition(base.Name, clientModuleName);
        }

        public override Type ServiceType
        {
            get { return typeof(CustomBasicAuthenticationModuleService); }
        }

        public override string FriendlyName
        {
            get { return "CustomBasicAuthentication"; }
        }

        public override bool SupportsScope(ManagementScope scope)
        {
            return true;
        }
    }
}
